package Day08_18;

import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Test_File01 {
    public static void main(String[] args) throws IOException {
        File f1 = new File("D:\\File\\A\\B\\C\\D ");
        if(!f1.exists()){
         //   f1.createNewFile();
            f1.mkdirs();
        }
        String parentPath = f1.getParent();
        System.out.println(parentPath);
        String parentFile = f1.getAbsolutePath();
        System.out.println(parentFile);

        String s1 = f1.getName();
        System.out.println(s1);

        System.out.println(f1.isFile());
        System.out.println(f1.isDirectory());

        long s = f1.lastModified();
        Date date = new Date(s);
        SimpleDateFormat sdf = new SimpleDateFormat();
        System.out.println( sdf.format(date) );

        System.out.println(f1.length() +"KB");

        File[] f2 = f1.listFiles();
        for(File i:f2){
            System.out.println(i.getName());
        }

    }
}
